#!/usr/bin/env ruby

require "#{LKP_SRC}/lib/tests/stats"
stats = LKP::Stats.new

while (line = $stdin.gets)
  next if line =~ /fs_metadata|page_poisoning/

  case line
  when /^\s+(.+) --.* pass/
    stats.add_test_result line, $1, "pass"
  when /^\s+(.+) --.* failed/, /^\s+(.+) --.*no .* finished/
    stats << $1, "fail"
  when /^\s+(.+) --.* skip/
    stats << $1, "skip"
  when /(^[a-zA-Z].*?)\s+PASS\s+/
    stats << $1.downcase, "pass"
  when /(^[a-zA-Z].*?)\s+FAIL\s+/
    stats << $1.downcase, "fail"
  end
end

stats.dump
